package com.Pounds.dao.Impl;

import com.Pounds.dao.DaoController;
import com.Pounds.mapper.ControlMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

@Repository
public class DaoControllerImpl implements DaoController {
    // 暂且分配，后续需要改进为动态分配模式，即从控制类中获取需要响应的表
    private final String userDataBase = "UserData_1";

    @Autowired
    private ControlMapper controlMapper;

    @Override
    public String findDatabase(String name) {
        return controlMapper.findDatabase(userDataBase, name);
    }

    @Override
    public String findTable(String name) {
        return controlMapper.findTable(userDataBase, name);
    }

    @Override
    public void newDatabase(String name) {
        controlMapper.newDatabase(userDataBase, name);
    }

    @Override
    public void newTable(String name, String defineTable) {
        controlMapper.newTable(userDataBase, name, defineTable);
    }
}
